package com.lianqi.emcpframework.core.bean;

import java.util.Map;

/**
 * @program emcp-framework
 * @ClassName MapProperty
 * @description: map属性操作类
 * @author: sky
 * @create: 2018/11/24 10:16
 */
public class MapProperty extends Property{

    public MapProperty(String name){
        type = Object.class;
        this.name = name;
        this.readMethodName = "get";
        this.writeMethodName = "put";

        this.getter = getterFunction();
        this.setter = setterFunction(paramGetter -> "put(\"" + name +"\"," + paramGetter + ")");
        beanType = Map.class;
    }

    @Override
    public String getReadMethod() {
        return "get(\""+ name +"\")";
    }

    @Override
    public String getReadMethodName() {
        return this.getReadMethod();
    }
}
